window.onload=function (){
     
	 if($(".acf-th-download_file").html()!=null){
		 //alert("download");		 
		//$(".label").before
		$("#acf-download").prepend('<input type="button" class="submitdelete deletion" style="margin-left:20px" id="setImg" value="图片全部设为pdf"/><input  type="button" class="submitdelete deletion" style="margin-left:20px" id="setText" value="把图片名称设置为第二项"/>');
		

	 		  
		 
	 }

	 
	 
		 $("#setImg").click(function(){	
			 $(".ui-sortable .row").each(function(){ 
				var a = $(this).find("td[data-field_name='download_img']").find(".acf-image-value").val();
				if(a==""){
					$(this).find("td[data-field_name='download_img']").find(".acf-image-value").val("420");//图片设置为pdf的
					$(this).find("td[data-field_name='download_img']").find(".has-image").show();
					$(this).find("td[data-field_name='download_img']").find(".no-image").hide();		 
					$(this).find("td[data-field_name='download_img']").find(".has-image .acf-image-image").attr("src","/uploads/pdf.png")
				} 			 
			 }) 
		 })	 
		 
		 $("#setText").click(function(){ 			 
			$(".ui-sortable .row").each(function(){ 
			var a= $(this).find("td[data-field_name='download_text']").find('input[type="text"]').val();
			 console.log(a);
			 if(a==""){		
			 var b=$(this).find("td[data-field_name='download_file']").find(".acf-file-title").html();
			 $(this).find("td[data-field_name='download_text']").find('input[type="text"]').val(b)
				} 
			})

			 
		 })	 		 
		 
		 
	 
}